package com.gree.portal.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.gree.rpc.service.GoodsCategoryService;
import com.gree.rpc.vo.GoodsCategoryVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 商品controller
 */
@Controller
@RequestMapping("/goodsCategory")
public class GoodController {

   @Reference(interfaceClass = GoodsCategoryService.class)
   private GoodsCategoryService goodsCategoryService;

    /**
     * 查询商品分类列表
     * @return
     */
    @RequestMapping("/list")
    @ResponseBody
    public List<GoodsCategoryVo> categoryList() throws JsonProcessingException {
        return goodsCategoryService.selectCategoryListForView();
    }
}
